package com.gopay.common.cps.dao.bank.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.cps.dao.bank.BisBankProdChCostDAO;
import com.gopay.common.domain.bis.BisBankProdChCost;

/**
 * @BisBankProdChCostDAOImpl.java
 * @author wanggang
 * @2014-1-9 下午4:17:26 www.gopay.com.cn Inc.All rights reserved.
 */
@Repository("bisBankProdChCostDAO")
public class BisBankProdChCostDAOImpl extends BaseDAOImpl<BisBankProdChCost, Integer> implements BisBankProdChCostDAO {

    @Override
    public BisBankProdChCost getBisBankProdChCost(String prodCode, String channelCode, String bankCode) {
        DetachedCriteria criteria = DetachedCriteria.forClass(BisBankProdChCost.class);
        criteria.add(Restrictions.eq("prodCode",prodCode));
        criteria.add(Restrictions.eq("channelCode",channelCode));
        criteria.add(Restrictions.eq("bankCode",bankCode));
        List<BisBankProdChCost> list = this.findByCriteria(criteria);
        return list.size()>0 ? list.get(0): null;
    }
    
}
